Neurosis Engine
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
CNeurosisWindow Class Reference

#include <window.h>

List of all members.

Classes

struct  STexture

Public Member Functions

 CNeurosisWindow (float zNear, float zFar, char *engineLogFilename=NULL)
 ~CNeurosisWindow ()
 Constructor/Deconstructor.
void Font_Begin (int iTexture)
 Call before Font_... calls.
void Font_End ()
 Call after Font_... calls.
bool Font_List_Load (char *filename)
 Loads position of font values (list from [0..127] with 5 integers per line ... ASCII# x1 x2 y1 y2)
void Font_List_Print (float x, float y, float size, float r, float g, float b, bool alignCenter, bool alignRight, const char *fmt,...)
 Print out string - x/y positioning based on percentage of screen - (0,0 == bottom left)
void Font_String (float x, float y, float size, float r, float g, float b, bool centerText, const char *fmt,...)
 Print out string - x/y positioning based on percentage of screen - (0,0 == bottom left)
int Get_Previous_Texture ()
 Get mPreviousTexture value.
int Get_Total_Textures ()
 Get mTotalTextures value.
void GL_Cleanup ()
 Cleanup OpenGL.
bool GL_Create_Window (char *title, int width, int height, int bits, bool fullscreen, bool allowResize, bool centerWindow, bool showCursor)
 Create OpenGL window.
void GL_Initialize ()
 Initialize OpenGL - not needed unless not calling GL_Create_Window(...) - such as when using MFC.
void GL_Perspective (float field_of_view, float aspect)
 Sets the frustum (perspective)
POINT Mouse_Coordinates ()
 Get mouse coordinates in respect to the current window.
void Process_Messages ()
 Process window messages.
void Render_Triangle (int iTexture, float r, float g, float b, float transparency, float bottomLeftX, float bottomLeftY, float bottomLeftZ, float topRightX, float topRightY, float topRightZ, float topLeftX, float topLeftY, float topLeftZ, float bottomLeftPercentX=0.0f, float bottomLeftPercentY=0.0f, float topRightPercentX=1.0f, float topRightPercentY=1.0f, float topLeftPercentX=0.0f, float topLeftPercentY=1.0f)
 Draws triangle to screen (if not textured, set iTexture = -1)
void Render_Quad (int iTexture, float r, float g, float b, float transparency, float bottomLeftX, float bottomLeftY, float bottomLeftZ, float bottomRightX, float bottomRightY, float bottomRightZ, float topRightX, float topRightY, float topRightZ, float topLeftX, float topLeftY, float topLeftZ, float bottomLeftPercentX=0.0f, float bottomLeftPercentY=0.0f, float bottomRightPercentX=1.0f, float bottomRightPercentY=0.0f, float topRightPercentX=1.0f, float topRightPercentY=1.0f, float topLeftPercentX=0.0f, float topLeftPercentY=1.0f)
 Draws quad to screen (if not textured, set iTexture = -1)
void Resize_Window (int width, int height)
 Resize window.
void Screenshot_Capture (char *filename, bool isDesktop, int customX=0, int customY=0, int customWidth=0, int customHeight=0)
 Save screenshot of desktop or application (as .png) - can also set start/end coordinates values of the screen to capture.
void Set_Previous_Texture (int iTexture)
 Set mPreviousTexture value [0..mTotalTextures-1].
void Set_Window_Title (char *title)
 Set the title of the main window.
GLuint Texture_Get_Data (int index)
 Get texture data.
char * Texture_Get_Name (int index)
 Get texture filename.
int Texture_Load (char *filename, int index=-1)
 Load texture (will overwrite specific texture if index is given, mask color default is black) - returns -1 if it fails.
void Texture_Remove (int index)
 Remove texture.
void Texture_Remove_All ()
 Remove all textures.
void Textures_Reload ()
 Reload all textures.
void Video_Capture (float timeStep)
 Capture frame to video.
void Video_Cleanup ()
 Cleanup and close video file.
void Video_Initialize (char *filename, int desiredFPS)
 Initialize video file.

Public Attributes

HDC hDC
HINSTANCE hInstance
HWND hWnd
bool pKeys [256]
FILE * pEngineLog
float pFontList [128][4]
bool mActive
bool mMinimized
MSG mMsg
bool mQuit
float mZFar
float mZNear
int mScreenHeight
int mScreenWidth

Private Member Functions

bool Build_GDI (char *filename, int index)
 Binds .* file to texture (used by Texture_Load - uses GDI+)
float3 Font_String_Get_Percent (int letter)
 Get position of font letter.
int Get_Encoder_Clsid (const WCHAR *format, CLSID *pClsid)
 Receives the MIME type of an encoder and returns the class identifier (CLSID) of that encoder.

Private Attributes

HGLRC hRC
STexturepTextures
PAVIFILE pVideoFile
PAVISTREAM pVideoStream
bool mFullscreen
float mVideoDesiredTimeInterval
float mVideoTimeLapse
GdiplusStartupInput mGdiplusStartupInput
int mPreviousTexture
int mTotalTextures
long mVideoFrame
ULONG_PTR mGdiplusToken

Constructor & Destructor Documentation

CNeurosisWindow::CNeurosisWindow ( float  zNear,
float  zFar,
char *  engineLogFilename = NULL 
)

Constructor/Deconstructor.


Member Function Documentation

bool CNeurosisWindow::Build_GDI ( char *  filename,
int  index 
) [private]

Binds .* file to texture (used by Texture_Load - uses GDI+)

void CNeurosisWindow::Font_Begin ( int  iTexture)

Call before Font_... calls.

Call after Font_... calls.

bool CNeurosisWindow::Font_List_Load ( char *  filename)

Loads position of font values (list from [0..127] with 5 integers per line ... ASCII# x1 x2 y1 y2)

void CNeurosisWindow::Font_List_Print ( float  x,
float  y,
float  size,
float  r,
float  g,
float  b,
bool  alignCenter,
bool  alignRight,
const char *  fmt,
  ... 
)

Print out string - x/y positioning based on percentage of screen - (0,0 == bottom left)

void CNeurosisWindow::Font_String ( float  x,
float  y,
float  size,
float  r,
float  g,
float  b,
bool  centerText,
const char *  fmt,
  ... 
)

Print out string - x/y positioning based on percentage of screen - (0,0 == bottom left)

Get position of font letter.

int CNeurosisWindow::Get_Encoder_Clsid ( const WCHAR *  format,
CLSID *  pClsid 
) [private]

Receives the MIME type of an encoder and returns the class identifier (CLSID) of that encoder.

Get mPreviousTexture value.

Get mTotalTextures value.

Cleanup OpenGL.

bool CNeurosisWindow::GL_Create_Window ( char *  title,
int  width,
int  height,
int  bits,
bool  fullscreen,
bool  allowResize,
bool  centerWindow,
bool  showCursor 
)

Create OpenGL window.

Initialize OpenGL - not needed unless not calling GL_Create_Window(...) - such as when using MFC.

void CNeurosisWindow::GL_Perspective ( float  field_of_view,
float  aspect 
)

Sets the frustum (perspective)

Get mouse coordinates in respect to the current window.

Process window messages.

void CNeurosisWindow::Render_Quad ( int  iTexture,
float  r,
float  g,
float  b,
float  transparency,
float  bottomLeftX,
float  bottomLeftY,
float  bottomLeftZ,
float  bottomRightX,
float  bottomRightY,
float  bottomRightZ,
float  topRightX,
float  topRightY,
float  topRightZ,
float  topLeftX,
float  topLeftY,
float  topLeftZ,
float  bottomLeftPercentX = 0.0f,
float  bottomLeftPercentY = 0.0f,
float  bottomRightPercentX = 1.0f,
float  bottomRightPercentY = 0.0f,
float  topRightPercentX = 1.0f,
float  topRightPercentY = 1.0f,
float  topLeftPercentX = 0.0f,
float  topLeftPercentY = 1.0f 
)

Draws quad to screen (if not textured, set iTexture = -1)

void CNeurosisWindow::Render_Triangle ( int  iTexture,
float  r,
float  g,
float  b,
float  transparency,
float  bottomLeftX,
float  bottomLeftY,
float  bottomLeftZ,
float  topRightX,
float  topRightY,
float  topRightZ,
float  topLeftX,
float  topLeftY,
float  topLeftZ,
float  bottomLeftPercentX = 0.0f,
float  bottomLeftPercentY = 0.0f,
float  topRightPercentX = 1.0f,
float  topRightPercentY = 1.0f,
float  topLeftPercentX = 0.0f,
float  topLeftPercentY = 1.0f 
)

Draws triangle to screen (if not textured, set iTexture = -1)

void CNeurosisWindow::Resize_Window ( int  width,
int  height 
)

Resize window.

void CNeurosisWindow::Screenshot_Capture ( char *  filename,
bool  isDesktop,
int  customX = 0,
int  customY = 0,
int  customWidth = 0,
int  customHeight = 0 
)

Save screenshot of desktop or application (as .png) - can also set start/end coordinates values of the screen to capture.

void CNeurosisWindow::Set_Previous_Texture ( int  iTexture)

Set mPreviousTexture value [0..mTotalTextures-1].

void CNeurosisWindow::Set_Window_Title ( char *  title)

Set the title of the main window.

GLuint CNeurosisWindow::Texture_Get_Data ( int  index)

Get texture data.

char* CNeurosisWindow::Texture_Get_Name ( int  index)

Get texture filename.

int CNeurosisWindow::Texture_Load ( char *  filename,
int  index = -1 
)

Load texture (will overwrite specific texture if index is given, mask color default is black) - returns -1 if it fails.

void CNeurosisWindow::Texture_Remove ( int  index)

Remove texture.

Remove all textures.

Reload all textures.

void CNeurosisWindow::Video_Capture ( float  timeStep)

Capture frame to video.

Cleanup and close video file.

void CNeurosisWindow::Video_Initialize ( char *  filename,
int  desiredFPS 
)

Initialize video file.


Member Data Documentation

HGLRC CNeurosisWindow::hRC [private]
GdiplusStartupInput CNeurosisWindow::mGdiplusStartupInput [private]
ULONG_PTR CNeurosisWindow::mGdiplusToken [private]
PAVIFILE CNeurosisWindow::pVideoFile [private]
PAVISTREAM CNeurosisWindow::pVideoStream [private]

The documentation for this class was generated from the following file: